home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13095 < prev    next >
Encoding:
Text File  |  1996-08-05  |  3.6 KB  |  84 lines

  1. Newsgroups: comp.object,comp.lang.eiffel,comp.lang.c++,comp.lang.beta,comp.lang.java,comp.lang.sather
  2. Path: in2.uu.net!allegra!alice!bs
  3. From: bs@research.att.com (Bjarne Stroustrup <9758-26353> 0112760)
  4. Subject: Re: What Should An Exception Handling Do? -- Clarification of rules
  5. Message-ID: <Doq3sv.MzA@research.att.com>
  6. Organization: Info. Sci. Div., AT&T Bell Laboratories, Murray Hill, NJ
  7. References: <4irn11$7ln@mimas.brunel.ac.uk> <Pine.Sola.3.91.960322041345.17711C-100000@ux5.cso.uiuc.edu> <4j03p4$fbt@hoho.quake.net>
  8. Date: Sat, 23 Mar 1996 13:50:55 GMT
  9.  
  10. billf@jovial.com (Bill Foote) writes
  11.  
  12.  
  13.  > > quote explaining why C++ (and Java) uses the termination model
  14.  > > of exception handling
  15.  > 
  16.  > A cynic might conclude something more along these lines:  "It would be hard
  17.  > to implement resumable exceptions in C++, so they decided to punt."
  18.  
  19. and that "cynic" would be wrong, guilty of not having done his homework,
  20. and guilty of making unkind conjectures without basis in facts.
  21.  
  22.  > It's not too hard to come up with examples where it would be nice to have
  23.  > resumable exceptions.  One example is resource acquisition.  Upon failure
  24.  > to acquire a resource (a file descriptor, some memory, etc.) it might be
  25.  > nice if a top-level exception handler could try to free up some resources,
  26.  > and if it can, try to resume from the exception.
  27.  
  28. This point, and many others were seriously studied by the C++ standards
  29. committee before it approved my design of exception handling for C++.
  30. The arguments for and against resumption can be found in chapter 16 of
  31.  
  32.     Bjarne Stroustrup:
  33.     The Design and Evolution of C++
  34.     Addison-Wesley ISBN 0-201-54330-3
  35.  
  36. together with a description of the complete language features and examples
  37. of their use.
  38.  
  39. Here, I'd like to quote a key section:
  40.  
  41.     Then, at the Palo Alto meeting in November 1991, we heard a
  42.     brilliant summary of the arguments for termination semantics
  43.     backed with both personal experience and data from Jim Mitchell
  44.     (from Sun, formerly from Xerox PARC). Jim had used exception
  45.     handling in half a dozen languages over a period of 20 years
  46.     and was an early proponent of resumption semantics as one of
  47.     the main designers and implementers of Xerox's Cedar/Mesa system.
  48.     His message was
  49.  
  50.         ``termination is preferred over resumption; this is
  51.         not a matter of opinion but a matter of years of
  52.         experience. Resumption is seductive, but not valid.''
  53.  
  54.     He backed this statement with experience from several operating
  55.     systems. The key example was Cedar/Mesa: It was written by people
  56.     who liked and used resumption, but after ten years of use, there
  57.     was only one use of resumption left in the half million line
  58.     system -- and that was a context inquiry. Because resumption
  59.     wasn't actually necessary for such a context inquiry, they removed
  60.     it and found a significant speed increase in that part of the
  61.     system. In each and every case where resumption had been used
  62.     it had -- over the ten years -- become a problem and a more
  63.     appropriate design had replaced it. Basically, every use of
  64.     resumption had represented a failure to keep separate levels
  65.     of abstraction disjoint
  66.  
  67.     Mary Fontana presented similar data from the TI Explorer system
  68.     where resumption was found to be used for debugging only, Aron
  69.      Insinga presented evidence of the very limited and nonessential
  70.     use of resumption in DEC's VMS, and Kim Knuttilla related exactly
  71.     the same story as Jim Mitchell for two large and long-lived
  72.     projects inside IBM. To this we added a strong opinion in favor
  73.      of termination based on experience at L.M.Ericsson relayed to
  74.     us by Dag Bruck.
  75.  
  76.     Thus, the C++ committee endorsed termination semantics.
  77.  
  78.  > Oh well.
  79.  
  80. Indeed
  81.  
  82.     - Bjarne
  83.  
  84.